package com.weaver.shuiguict.action;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.DetailTableInfo;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;

public class TestAction  implements Action {

    private static final Logger LOGGER = LoggerFactory.getLogger("ChangeDocStatusnwAction");

    @Override
    public String execute(RequestInfo requestInfo) {
        ChangeDocStatusnwAction changeDocStatusnwAction = new ChangeDocStatusnwAction();
        String fbfw = "";
        String mlid = "";
        String wdid = "";
        Property[] propertyArry = requestInfo.getMainTableInfo().getProperty();
        LOGGER.info("start execute = requestInfo.getMainTableInfo().getProperty();");
        DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();

        LOGGER.info("start execute = requestInfo.detailTableInfo()");
        for (Property property : propertyArry) {
            String name = property.getName();
            String value = Util.null2String(property.getValue());
            //获取内外网的值判断是内网还是外网  fbfw  0是外网发布 1是内网发布1,0是内外网发布
            if ("mlid".equals(name)) {
                mlid = value;
            }
            if ("wdid".equals(name)) {
                wdid = value;
            }
        }
        boolean b = false;
        try {
            b = changeDocStatusnwAction.executeMove(fbfw,mlid,wdid);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return b ? "1" : "0";
    }
}
